.PHONY: build run stop clean docker-build docker-run docker-stop docker-clean npm-pack

# 默认目标
all: docker-build docker-run

# 本地npm操作
install:
	npm install

start:
	node example/invokeWorkflow.js

npm-pack:
	npm pack

# Docker操作
docker-build:
	docker build -t workflow-sdk-nodejs .

docker-run:
	docker run --name workflow-sdk-container -d workflow-sdk-nodejs

docker-stop:
	docker stop workflow-sdk-container || true

docker-clean: docker-stop
	docker rm workflow-sdk-container || true
	docker rmi workflow-sdk-nodejs || true

# 组合命令
build: install npm-pack

run: start

clean:
	rm -rf node_modules
	rm -f workflow-sdk-nodejs-*.tgz

# 完整的Docker工作流
docker-workflow: docker-clean docker-build docker-run

# 查看Docker容器日志
docker-logs:
	docker logs workflow-sdk-container

# 进入Docker容器
docker-shell:
	docker exec -it workflow-sdk-container sh